package COMP;

import java.awt.Color;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;

import javax.swing.JComponent;



class DrawSquare extends JComponent{
	int xpos;
	int ypos;
	int barHeight;
	int barHalfWidth;
	Color color;
	DrawSquare(int xpos,int ypos,int barHeight,int barHalfWidth,Color color){
		this.xpos = xpos;
		this.ypos = ypos;
		this.barHeight = barHeight;
		this.barHalfWidth = barHalfWidth;
		this.color = color;
		this.setBounds(xpos-barHalfWidth, ypos-barHeight,barHalfWidth*2,barHeight);
		this.setOpaque(false);
	}
	public void paint(Graphics g){
		Graphics2D g2d = (Graphics2D)g.create();
		GradientPaint p = new GradientPaint(0,0,color.brighter(),
				this.getWidth(),0,color);
		g2d.setPaint(p);
		g2d.fillRect(0, 0, this.getWidth(),this.getHeight());
	}
}
